package com.example.leetcode.tree;

import com.example.leetcode.tree.common.TreeNode;
import com.example.leetcode.tree.common.TreeUtils;

/**
 * Definition for a binary tree node.
 * public class TreeNode {
 * int val;
 * TreeNode left;
 * TreeNode right;
 * TreeNode() {}
 * TreeNode(int val) { this.val = val; }
 * TreeNode(int val, TreeNode left, TreeNode right) {
 * this.val = val;
 * this.left = left;
 * this.right = right;
 * }
 * }
 */
class Solution654 {
    public TreeNode constructMaximumBinaryTree(int[] nums) {
        return TreeUtils.constructMaximumBinaryTree(nums);
    }
}

public class leetcode654 {
    public static void main(String[] args) {
        Solution654 solution654 = new Solution654();
        int[] nums = {3, 2, 1, 6, 0, 5};
        TreeNode root = solution654.constructMaximumBinaryTree(nums);
        System.out.println(TreeUtils.getLeetcodeTreeVals(root)); // 输出：[6,3,5,null,2,0,null,null,1]
    }
}
